<%@ page contentType="text/html;charset=GBK" %>
<%@ page import="java.util.*" %>
<%@ page import="com.ionglobal.db.*" %>
<%@ page import="com.ionglobal.lib.*" %>
<%@ page import="com.ionglobal.cms.*" %>
<%@ page import="com.ionglobal.misc.*" %>

<%@ include file="../init_include.jsp" %>

<%
	int curcategory=0;
	if(Request.getString("curcategory")!=null)
		curcategory=Integer.parseInt(Request.getString("curcategory"));
		
	int id = Request.getString("id")==null?0:Integer.parseInt(Request.getString("id"));
	
	String modulecode="";
	if(Request.getString("module")!=null)
		modulecode=Request.getString("module");
	String elementname="";
	if(Request.getString("elementname")!=null && Request.getString("elementname").length()>0)
		elementname=Request.getString("elementname");
	else
		elementname="which";
	String type="";
	if(Request.getString("type")!=null && Request.getString("type").length()>0)
		type=Request.getString("type");
	else
		type="radio";
%>

<HTML>
<HEAD>
<META content="text/html; charset=gb2312" http-equiv=Content-Type>
<META content="MSHTML 5.00.2920.0" name=GENERATOR></HEAD>
<link rel="stylesheet" href="../css.css" type="text/css">
<meta http-equiv="Content-Type" content="text/html; charset=<%=Language.getHTMLLanguageStr()%>">

<%	
	ArrayList ar;
	String str="";
	ItemData ca;
	int llaayy=0;
	ar=Tree.getLocalTreeByLayer(dbi,id,session);
	
	String BlankStr="<img src='../images/blank.gif' BORDER='0' width='11' heigth='10'>";
	int isheadid = id;
  String plusSrc	="<img src='../images/plus.gif' BORDER='0' ";    
  String minusSrc ="<img src='../images/minus.gif' BORDER='0' ";   
  String clickStr = "";
  int count=0;
  String disableStr="<input type="+type+" style=visibility:hidden>";

	  
	if(ar==null || ar.size()<1) clickStr="No Item Found in database!";
	if(ar!=null) {
	  for (int i=0;i<ar.size();i++) {							
		  ca=(ItemData)ar.get(i);
		  llaayy=ca.layer-1;
			clickStr += "<table width='100%' border=0 cellspacing=0 cellpadding=0>";
			if(i%2==1) 
				clickStr += "<tr  bgcolor=#dddddd>";
			else 
				clickStr += "<tr  bgcolor=#ff9933>";
		
			for(int j=0;j<llaayy+1;j++) {
			  clickStr +="<td width=20 nowrap align=center>";
			  clickStr += BlankStr;
			}
			clickStr += "<td nowrap align=center height=20>";
  	  if (ca.isLeaf) {
      	clickStr+=BlankStr;		
    	}else{
        clickStr+="<a href='javascript:loadThreadFollow("+ca.id+");'>"+plusSrc+" id='followImg"+ca.id+"'></a>";		
    	}
    	clickStr+= "</td><td width=99% nowrap height=20>&nbsp;";
    	if(ca.id==curcategory) {
				if(ca.modulecode!=null && ca.modulecode.equalsIgnoreCase(modulecode) || modulecode.equalsIgnoreCase("BMS")) {
      	 	if(ca.rightflag)
						clickStr+= "<input type="+type+" name="+elementname+" value='"+ca.id+"' checked>";
					else
			  		clickStr+= disableStr;
			  	count++;				
				} else {
					clickStr+= disableStr;
				}
			} else {
				if(ca.modulecode!=null && ca.modulecode.equalsIgnoreCase(modulecode) || modulecode.equalsIgnoreCase("BMS")) {
       		if(ca.rightflag)
						clickStr+= "<input type="+type+" name="+elementname+" value='"+ca.id+"' onClick='send(\\\""+ca.name+"\\\","+ca.id+")'>";
					else
				  	clickStr+= disableStr;					
					count++;				
				} else {
			  	clickStr+= disableStr;
				}
			}
    	clickStr+=Utilities.strReplace(ca.name,"'","\\'");      
    	clickStr+= "</td></tr></table>";
    	if(!ca.isLeaf) {
    		clickStr+= "<table width='100%'  border=0 cellspacing=0 cellpadding=0 valign='center'>";  
      	clickStr+="<tr style='display:none' id='follow"+ca.id+"'><td  nowrap colspan=2 id=followTd"+ca.id+" >";
      	clickStr+="</td><tr>";
      	clickStr +="</table>"; 
    	}
    }      
  }
%> 
<SCRIPT>
  parent.followTd<%=id%>.innerHTML="<%=clickStr%>";
</SCRIPT>
</HEAD>
<body>
</BODY>
</HTML>

<%@ include file="../init_free.jsp" %>

